﻿using System;
using System.Collections.Generic;
using SystemModule;

namespace M2Server
{
    public class ScriptBase
    {
        public static bool GetValValue(TPlayObject PlayObject, string sMsg, ref int nValue)
        {
            bool result = false;
            int n01;
            try
            {
                result = false;
                if (sMsg == "")
                {
                    return result;
                }
                n01 = M2Share.GetValNameNo(sMsg);
                if (n01 >= 0)
                {
                    if (HUtil32.rangeInDefined(n01, 0, 99))
                    {
                        nValue = PlayObject.m_nVal[n01];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 100, 199))
                    {
                        nValue = M2Share.g_Config.GlobalVal[n01 - 100];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 200, 299))
                    {
                        nValue = PlayObject.m_DyVal[n01 - 200];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 300, 399))
                    {
                        nValue = PlayObject.m_nMval[n01 - 300];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 400, 499))
                    {
                        nValue = M2Share.g_Config.GlobaDyMval[n01 - 400];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 500, 599))
                    {
                        nValue = PlayObject.m_nInteger[n01 - 500];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 800, 1199))
                    {
                        nValue = M2Share.g_Config.GlobalVal[n01 - 700]; //G变量
                        result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetValValue1");
            }
            return result;
        }

        public static bool GetValValue(TPlayObject PlayObject, string sMsg, ref string sValue)
        {
            bool result = false;
            int n01;
            try
            {
                result = false;
                if (sMsg == "")
                {
                    return result;
                }
                n01 = M2Share.GetValNameNo(sMsg);
                if (n01 >= 0)
                {
                    if (HUtil32.rangeInDefined(n01, 600, 699))
                    {
                        sValue = PlayObject.m_sString[n01 - 600];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 700, 799))
                    {
                        sValue = M2Share.g_Config.GlobalAVal[n01 - 700];
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 1200, 1599))
                    {
                        sValue = M2Share.g_Config.GlobalAVal[n01 - 1100];// A变量(100-499)
                        result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetValValue2");
            }
            return result;
        }

        public static bool SetValValue(TPlayObject PlayObject, string sMsg, int nValue)
        {
            bool result = false;
            int n01;
            try
            {
                result = false;
                if (sMsg == "")
                {
                    return result;
                }
                n01 = M2Share.GetValNameNo(sMsg);
                if (n01 >= 0)
                {
                    if (HUtil32.rangeInDefined(n01, 0, 99))
                    {
                        PlayObject.m_nVal[n01] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 100, 199))
                    {
                        M2Share.g_Config.GlobalVal[n01 - 100] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 200, 299))
                    {
                        PlayObject.m_DyVal[n01 - 200] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 300, 399))
                    {
                        PlayObject.m_nMval[n01 - 300] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 400, 499))
                    {
                        M2Share.g_Config.GlobaDyMval[n01 - 400] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 500, 599))
                    {
                        PlayObject.m_nInteger[n01 - 500] = nValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 800, 1199))
                    {
                        M2Share.g_Config.GlobalVal[n01 - 700] = nValue;// G变量
                        result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.SetValValue1");
            }
            return result;
        }

        public static bool SetValValue(TPlayObject PlayObject, string sMsg, string sValue)
        {
            bool result = false;
            int n01;
            try
            {
                result = false;
                if (sMsg == "")
                {
                    return result;
                }
                n01 = M2Share.GetValNameNo(sMsg);
                if (n01 >= 0)
                {
                    if (HUtil32.rangeInDefined(n01, 600, 699))
                    {
                        PlayObject.m_sString[n01 - 600] = sValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 700, 799))
                    {
                        M2Share.g_Config.GlobalAVal[n01 - 700] = sValue;
                        result = true;
                    }
                    else if (HUtil32.rangeInDefined(n01, 1200, 1599))
                    {
                        M2Share.g_Config.GlobalAVal[n01 - 1100] = sValue;// A变量(100-499)
                        result = true;
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.SetValValue2");
            }
            return result;
        }

        /// <summary>
        /// 取行文本变量信息
        /// </summary>
        /// <param name="PlayObject"></param>
        /// <param name="sMsg"></param>
        /// <returns></returns>
        public string GetLineVariableText(TNormNpc NormNpc, TPlayObject PlayObject, string sMsg)
        {
            string result = string.Empty;
            int nC;
            string s10 = string.Empty;
            try
            {
                nC = 0;
                while (true)
                {
                    if (HUtil32.TagCount(sMsg, '>') < 1)
                    {
                        break;
                    }
                    HUtil32.ArrestStringEx(sMsg, "<", ">", ref s10);
                    GetVariableText(NormNpc, PlayObject, ref sMsg, s10);
                    nC++;
                    if (nC >= 101)
                    {
                        break;
                    }
                }
                result = sMsg;
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetLineVariableText");
            }
            return result;
        }

        /// <summary>
        /// 取变量文本
        /// </summary>
        public static void GetVariableText(TNormNpc NormNpc, TPlayObject PlayObject, ref string sMsg, string sVariable)
        {
            string sText = string.Empty;
            string s14 = string.Empty;
            int n18;
            ushort wHour;
            ushort wMinute;
            ushort wSecond;
            int nSecond;
            TDynamicVar DynamicVar;
            bool boFoundVar;
            string s1C;
            TPlayObject PoseHuman;
            try
            {
                // 显示人物排行
                if (sVariable == "$LEVELORDER")
                {
                    s1C = "";
                    if (PlayObject.m_PlayOrderList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_PlayOrderList.Count; i++)
                        {
                            s1C = s1C + PlayObject.m_PlayOrderList[i];
                        }
                    }
                    sMsg = sub_49ADB8(sMsg, "<$LEVELORDER>", s1C);
                    return;
                }
                if (sVariable == "$DEALGOLDPLAY")
                {
                    PoseHuman = ((TPlayObject)(PlayObject.GetPoseCreate()));
                    if ((PoseHuman != null) && (((TPlayObject)(PoseHuman.GetPoseCreate())) == PlayObject) && (PoseHuman.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                    {
                        sMsg = sub_49ADB8(sMsg, "<$DEALGOLDPLAY>", PoseHuman.m_sCharName);
                    }
                    else
                    {
                        sMsg = sub_49ADB8(sMsg, "<$DEALGOLDPLAY>", "????");
                    }
                    return;
                }
                // 全局信息
                if (sVariable == "$SERVERNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$SERVERNAME>", M2Share.g_Config.sServerName);
                    return;
                }
                if (sVariable == "$SERVERIP")
                {
                    sMsg = sub_49ADB8(sMsg, "<$SERVERIP>", M2Share.g_Config.sServerIPaddr);
                    return;
                }
                if (sVariable == "$WEBSITE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$WEBSITE>", M2Share.g_Config.sWebSite);
                    return;
                }
                if (sVariable == "$BBSSITE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BBSSITE>", M2Share.g_Config.sBbsSite);
                    return;
                }
                if (sVariable == "$CLIENTDOWNLOAD")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CLIENTDOWNLOAD>", M2Share.g_Config.sClientDownload);
                    return;
                }
                if (sVariable == "$QQ")
                {
                    sMsg = sub_49ADB8(sMsg, "<$QQ>", M2Share.g_Config.sQQ);
                    return;
                }
                if (sVariable == "$PHONE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$PHONE>", M2Share.g_Config.sPhone);
                    return;
                }
                if (sVariable == "$BANKACCOUNT0")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT0>", M2Share.g_Config.sBankAccount0);
                    return;
                }
                if (sVariable == "$BANKACCOUNT1")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT1>", M2Share.g_Config.sBankAccount1);
                    return;
                }
                if (sVariable == "$BANKACCOUNT2")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT2>", M2Share.g_Config.sBankAccount2);
                    return;
                }
                if (sVariable == "$BANKACCOUNT3")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT3>", M2Share.g_Config.sBankAccount3);
                    return;
                }
                if (sVariable == "$BANKACCOUNT4")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT4>", M2Share.g_Config.sBankAccount4);
                    return;
                }
                if (sVariable == "$BANKACCOUNT5")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT5>", M2Share.g_Config.sBankAccount5);
                    return;
                }
                if (sVariable == "$BANKACCOUNT6")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT6>", M2Share.g_Config.sBankAccount6);
                    return;
                }
                if (sVariable == "$BANKACCOUNT7")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT7>", M2Share.g_Config.sBankAccount7);
                    return;
                }
                if (sVariable == "$BANKACCOUNT8")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT8>", M2Share.g_Config.sBankAccount8);
                    return;
                }
                if (sVariable == "$BANKACCOUNT9")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BANKACCOUNT9>", M2Share.g_Config.sBankAccount9);
                    return;
                }
                if (sVariable == "$GAMEGOLDNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$GAMEGOLDNAME>", M2Share.g_Config.sGameGoldName);
                    return;
                }
                if (sVariable == "$GAMEDIAMONDNAME")
                {
                    // 金刚石
                    sMsg = sub_49ADB8(sMsg, "<$GAMEDIAMONDNAME>", M2Share.g_Config.sGameDiaMond);
                    return;
                }
                if (sVariable == "$GAMEGIRDNAME")
                {
                    // 灵符
                    sMsg = sub_49ADB8(sMsg, "<$GAMEGIRDNAME>", M2Share.g_Config.sGameGird);
                    return;
                }
                if (sVariable == "$GAMEPOINTNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$GAMEPOINTNAME>", M2Share.g_Config.sGamePointName);
                    return;
                }
                if (sVariable == "$USERCOUNT")
                {
                    sText = (M2Share.UserEngine.PlayObjectCount).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$USERCOUNT>", sText);
                    return;
                }
                if (sVariable == "$MACRUNTIME")
                {
                    // (24 * 60 * 60 * 1000)
                    sText = (HUtil32.GetTickCount() / 86400000).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MACRUNTIME>", sText);
                    return;
                }
                if (sVariable == "$SERVERRUNTIME")
                {
                    nSecond = Convert.ToInt32((HUtil32.GetTickCount() - M2Share.g_dwStartTick) / 1000);
                    wHour = Convert.ToUInt16(nSecond / 3600);
                    wMinute = Convert.ToUInt16((nSecond / 60) % 60);
                    wSecond = Convert.ToUInt16(nSecond % 60);
                    sText = string.Format("{0}:{1}:{2}", wHour, wMinute, wSecond);
                    sMsg = sub_49ADB8(sMsg, "<$SERVERRUNTIME>", sText);
                    return;
                }
                if (sVariable == "$DATETIME")
                {
                    sText = HUtil32.FormatDateTime("dddddd,ddd,hh:mm:MM", DateTime.Now);
                    sMsg = sub_49ADB8(sMsg, "<$DATETIME>", sText);
                    return;
                }
                if (sVariable == "$HIGHLEVELINFO")
                {
                    // 最高等级人物数据
                    if (((TPlayObject)(M2Share.g_HighLevelHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighLevelHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHLEVELINFO>", sText);
                    return;
                }
                if (sVariable == "$HIGHPKINFO")
                {
                    // 最高PK值人物数据
                    if (((TPlayObject)(M2Share.g_HighPKPointHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighPKPointHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHPKINFO>", sText);
                    return;
                }
                if (sVariable == "$HIGHDCINFO")
                {
                    // 最高攻击力人物数据
                    if (((TPlayObject)(M2Share.g_HighDCHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighDCHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHDCINFO>", sText);
                    return;
                }
                if (sVariable == "$HIGHMCINFO")
                {
                    // 最高魔法力人物数据
                    if (((TPlayObject)(M2Share.g_HighMCHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighMCHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHMCINFO>", sText);
                    return;
                }
                if (sVariable == "$HIGHSCINFO")
                {
                    // 最高道术人物数据
                    if (((TPlayObject)(M2Share.g_HighSCHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighSCHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHSCINFO>", sText);
                    return;
                }
                if (sVariable == "$HIGHONLINEINFO")
                {
                    // 最高在线时长人物数据
                    if (((TPlayObject)(M2Share.g_HighOnlineHuman)) != null)
                    {
                        sText = ((TPlayObject)(M2Share.g_HighOnlineHuman)).GetMyInfo();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HIGHONLINEINFO>", sText);
                    return;
                }
                // 个人信息
                if (sVariable == "$USERNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$USERNAME>", PlayObject.m_sCharName);
                    return;
                }
                if (sVariable == "$USERALLNAME") // 全名 
                {
                    sMsg = sub_49ADB8(sMsg, "<$USERALLNAME>", PlayObject.GetShowName());
                    return;
                }
                if (sVariable == "$SFNAME") // 师傅名
                {
                    sMsg = sub_49ADB8(sMsg, "<$SFNAME>", PlayObject.m_sMasterName);
                    return;
                }
                if (sVariable == "$HERONAME") // 英雄名
                {
                    if (PlayObject.m_MyHero != null)
                    {
                        sMsg = sub_49ADB8(sMsg, "<$HERONAME>", ((THeroObject)(PlayObject.m_MyHero)).m_sCharName);
                        return;
                    }
                }
                if (sVariable == "$MAPNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$MAPNAME>", PlayObject.m_PEnvir.sMapDesc);
                    return;
                }
                if (sVariable == "$KILLER") // 杀人者变量
                {
                    if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                    {
                        if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                        {
                            sMsg = sub_49ADB8(sMsg, "<$KILLER>", PlayObject.m_LastHiter.m_sCharName);
                        }
                        else if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                        {
                            if (PlayObject.m_LastHiter.m_Master != null)
                            {
                                sMsg = sub_49ADB8(sMsg, "<$KILLER>", PlayObject.m_LastHiter.m_Master.m_sCharName);
                            }
                            else
                            {
                                sMsg = sub_49ADB8(sMsg, "<$KILLER>", "未知");
                            }
                        }
                    }
                    else
                    {
                        sMsg = sub_49ADB8(sMsg, "<$KILLER>", "未知");
                    }
                    return;
                }
                if (sVariable == "$MONKILLER") // 杀人的怪物变量
                {
                    if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                    {
                        if ((PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT) && (PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_HEROOBJECT))
                        {
                            sMsg = sub_49ADB8(sMsg, "<$MONKILLER>", PlayObject.m_LastHiter.m_sCharName);
                        }
                    }
                    else
                    {
                        sMsg = sub_49ADB8(sMsg, "<$MONKILLER>", "未知");
                    }
                    return;
                }
                if (sVariable == "$MAP")//增加地图ID参数
                {
                    sMsg = sub_49ADB8(sMsg, "<$MAP>", PlayObject.m_PEnvir.sMapName);
                    return;
                }
                if (sVariable == "$QUERYYBDEALLOG")
                {
                    // 查看元宝交易记录  20080318
                    sMsg = sub_49ADB8(sMsg, "<$QUERYYBDEALLOG>", PlayObject.SelectSellDate());
                    return;
                }
                if (sVariable == "$GUILDNAME")
                {
                    if (PlayObject.m_MyGuild != null)
                    {
                        sMsg = sub_49ADB8(sMsg, "<$GUILDNAME>", PlayObject.m_MyGuild.sGuildName);
                    }
                    else
                    {
                        sMsg = "无";
                    }
                    return;
                }
                if (sVariable == "$TAGMAPNAME1")
                {
                    // 记路标石记录地图名 20081019
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME1>", PlayObject.m_TagMapInfos[1].TagMapName);
                    return;
                }
                if (sVariable == "$TAGMAPNAME2")
                {
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME2>", PlayObject.m_TagMapInfos[2].TagMapName);
                    return;
                }
                if (sVariable == "$TAGMAPNAME3")
                {
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME3>", PlayObject.m_TagMapInfos[3].TagMapName);
                    return;
                }
                if (sVariable == "$TAGMAPNAME4")
                {
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME4>", PlayObject.m_TagMapInfos[4].TagMapName);
                    return;
                }
                if (sVariable == "$TAGMAPNAME5")
                {
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME5>", PlayObject.m_TagMapInfos[5].TagMapName);
                    return;
                }
                if (sVariable == "$TAGMAPNAME6")
                {
                    sMsg = sub_49ADB8(sMsg, "<$TAGMAPNAME6>", PlayObject.m_TagMapInfos[6].TagMapName);
                    return;
                }
                if (sVariable == "$TAGX1")
                {
                    // 记路标石记录X 20081019
                    sText = (PlayObject.m_TagMapInfos[1].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX1>", sText);
                    return;
                }
                if (sVariable == "$TAGX2")
                {
                    sText = (PlayObject.m_TagMapInfos[2].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX2>", sText);
                    return;
                }
                if (sVariable == "$TAGX3")
                {
                    sText = (PlayObject.m_TagMapInfos[3].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX3>", sText);
                    return;
                }
                if (sVariable == "$TAGX4")
                {
                    sText = (PlayObject.m_TagMapInfos[4].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX4>", sText);
                    return;
                }
                if (sVariable == "$TAGX5")
                {
                    sText = (PlayObject.m_TagMapInfos[5].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX5>", sText);
                    return;
                }
                if (sVariable == "$TAGX6")
                {
                    sText = (PlayObject.m_TagMapInfos[6].TagX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGX6>", sText);
                    return;
                }
                if (sVariable == "$TAGY1")
                {
                    // 记路标石记录Y 20081019
                    sText = (PlayObject.m_TagMapInfos[1].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY1>", sText);
                    return;
                }
                if (sVariable == "$TAGY2")
                {
                    sText = (PlayObject.m_TagMapInfos[2].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY2>", sText);
                    return;
                }
                if (sVariable == "$TAGY3")
                {
                    sText = (PlayObject.m_TagMapInfos[3].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY3>", sText);
                    return;
                }
                if (sVariable == "$TAGY4")
                {
                    sText = (PlayObject.m_TagMapInfos[4].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY4>", sText);
                    return;
                }
                if (sVariable == "$TAGY5")
                {
                    sText = (PlayObject.m_TagMapInfos[5].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY5>", sText);
                    return;
                }
                if (sVariable == "$TAGY6")
                {
                    sText = (PlayObject.m_TagMapInfos[6].TagY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$TAGY6>", sText);
                    return;
                }
                if (sVariable == "$GUILDMEMBERCOUNT")
                {
                    // 行会成员上限 20090115
                    if (PlayObject.m_MyGuild != null)
                    {
                        sText = (PlayObject.m_MyGuild.GuildMemberCount).ToString();
                        sMsg = sub_49ADB8(sMsg, "<$GUILDMEMBERCOUNT>", sText);
                        return;
                    }
                }
                if (sVariable == "$GUILDFOUNTAIN")
                {
                    // 行会泉水仓库 20080625
                    if (PlayObject.m_MyGuild != null)
                    {
                        sText = (PlayObject.m_MyGuild.m_nGuildFountain).ToString();
                        sMsg = sub_49ADB8(sMsg, "<$GUILDFOUNTAIN>", sText);
                        return;
                    }
                }
                if (sVariable == "$ALCOHOL")
                {
                    // 酒量 20080627
                    sText = (PlayObject.m_Abil.MaxAlcohol).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$$ALCOHOL>", sText);
                    return;
                }
                if (sVariable == "$MEDICINEVALUE")
                {
                    // 药力值 20080627
                    sText = (PlayObject.m_Abil.MedicineValue).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MEDICINEVALUE>", sText);
                    return;
                }
                if (sVariable == "$RANKNAME")
                {
                    sMsg = sub_49ADB8(sMsg, "<$RANKNAME>", PlayObject.m_sGuildRankName);
                    return;
                }
                if (sVariable == "$LEVEL")
                {
                    sText = (PlayObject.m_Abil.Level).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$LEVEL>", sText);
                    return;
                }
                if (sVariable == "$USEGAMEGIRD")// 每次使用灵符数，$USEGAMEGIRD变量使用
                {
                    sText = (PlayObject.m_UseGameGird).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$USEGAMEGIRD>", sText);
                    return;
                }
                if (sVariable == "$BUYSHOP")// 每次商铺花的元宝数量
                {
                    sText = (PlayObject.m_BuyShopPrice).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$BUYSHOP>", sText);
                    return;
                }
                if (sVariable == "$GETCRYSTALEXP") // 天地结晶可提取的经验
                {
                    sText = (PlayObject.m_nGetCrystalExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GETCRYSTALEXP>", sText);
                    return;
                }
                if (sVariable == "$GETCRYSTALNGEXP")// 天地结晶可提取的内功经验
                {
                    sText = (PlayObject.m_nGetCrystalNGExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GETCRYSTALNGEXP>", sText);
                    return;
                }
                if (sVariable == "$CRYSTALEXP")// 天地结晶当前的经验
                {
                    sText = (PlayObject.m_CrystalExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$CRYSTALEXP>", sText);
                    return;
                }
                if (sVariable == "$CRYSTALNGEXP")// 天地结晶当前的内功经验
                {
                    sText = (PlayObject.m_CrystalNGExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$CRYSTALNGEXP>", sText);
                    return;
                }
                if (sVariable == "$CRYSTALLEVEL")// 天地结晶等级
                {
                    sText = (HUtil32._MIN(5, PlayObject.m_CrystalLevel)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$CRYSTALLEVEL>", sText);
                    return;
                }
                if (sVariable == "$GETEXP")
                {
                    // 人物取得的经验 20081228
                    sText = (PlayObject.m_GetExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GETEXP>", sText);
                    return;
                }
                if (sVariable == "$HEROGETEXP")
                {
                    // 英雄取得的经验 20081228
                    if (PlayObject.m_MyHero != null)
                    {
                        sText = (((THeroObject)(PlayObject.m_MyHero)).m_GetExp).ToString();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$HEROGETEXP>", sText);
                    return;
                }
                if (sVariable == "$GLORYPOINT")
                {
                    // 人物荣誉值  20080512
                    sText = (PlayObject.m_btGameGlory).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GLORYPOINT>", sText);
                    return;
                }
                if (sVariable == "$STATSERVERTIME")
                {
                    // 显示M2启动时间
                    //sText = svMain.FrmMain.LbRunTime.Text;
                    sMsg = sub_49ADB8(sMsg, "<$STATSERVERTIME>", sText);
                    return;
                }
                if (sVariable == "$RUNDATETIME")
                {
                    // 开区间隔时间
                    //sText = svMain.FrmMain.LbTimeCount.Text;
                    sMsg = sub_49ADB8(sMsg, "<$RUNDATETIME>", sText);
                    return;
                }
                if (sVariable == "$RANDOMNO")
                {
                    // 随机值变量
                    sText = (HUtil32.Random(Int32.MaxValue)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$RANDOMNO>", sText);
                    return;
                }
                if (sVariable == "$USERID")
                {
                    // 登录账号
                    sText = PlayObject.m_sUserID;
                    sMsg = sub_49ADB8(sMsg, "<$USERID>", sText);
                    return;
                }
                if (sVariable == "$IPADDR")
                {
                    // 登录IP
                    sText = PlayObject.m_sIPaddr;
                    sMsg = sub_49ADB8(sMsg, "<$IPADDR>", sText);
                    return;
                }
                if (sVariable == "$X")
                {
                    // 人物X坐标
                    sText = (PlayObject.m_nCurrX).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$X>", sText);
                    return;
                }
                if (sVariable == "$Y")
                {
                    // 人物Y坐标
                    sText = (PlayObject.m_nCurrY).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$Y>", sText);
                    return;
                }
                if (sVariable == "$HP")
                {
                    sText = (PlayObject.m_WAbil.HP).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$HP>", sText);
                    return;
                }
                if (sVariable == "$MAXHP")
                {
                    sText = (PlayObject.m_WAbil.MaxHP).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXHP>", sText);
                    return;
                }
                if (sVariable == "$MP")
                {
                    sText = (PlayObject.m_WAbil.MP).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MP>", sText);
                    return;
                }
                if (sVariable == "$MAXMP")
                {
                    sText = (PlayObject.m_WAbil.MaxMP).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXMP>", sText);
                    return;
                }
                if (sVariable == "$AC")
                {
                    sText = (HUtil32.LoWord(PlayObject.m_WAbil.AC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$AC>", sText);
                    return;
                }
                if (sVariable == "$MAXAC")
                {
                    sText = (HUtil32.HiWord(PlayObject.m_WAbil.AC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXAC>", sText);
                    return;
                }
                if (sVariable == "$MAC")
                {
                    sText = (HUtil32.LoWord(PlayObject.m_WAbil.MAC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAC>", sText);
                    return;
                }
                if (sVariable == "$MAXMAC")
                {
                    sText = (HUtil32.HiWord(PlayObject.m_WAbil.MAC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXMAC>", sText);
                    return;
                }
                if (sVariable == "$DC")
                {

                    sText = (HUtil32.LoWord(PlayObject.m_WAbil.DC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$DC>", sText);
                    return;
                }
                if (sVariable == "$MAXDC")
                {
                    sText = (HUtil32.HiWord(PlayObject.m_WAbil.DC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXDC>", sText);
                    return;
                }
                if (sVariable == "$MC")
                {

                    sText = (HUtil32.LoWord(PlayObject.m_WAbil.MC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MC>", sText);
                    return;
                }
                if (sVariable == "$MAXMC")
                {

                    sText = (HUtil32.HiWord(PlayObject.m_WAbil.MC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXMC>", sText);
                    return;
                }
                if (sVariable == "$SC")
                {

                    sText = (HUtil32.LoWord(PlayObject.m_WAbil.SC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$SC>", sText);
                    return;
                }
                if (sVariable == "$MAXSC")
                {

                    sText = (HUtil32.HiWord(PlayObject.m_WAbil.SC)).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXSC>", sText);
                    return;
                }
                if (sVariable == "$EXP")
                {
                    sText = (PlayObject.m_Abil.Exp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$EXP>", sText);
                    return;
                }
                if (sVariable == "$MAXEXP")
                {
                    sText = (PlayObject.m_Abil.MaxExp).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXEXP>", sText);
                    return;
                }
                if (sVariable == "$PKPOINT")
                {
                    sText = (PlayObject.m_nPkPoint).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$PKPOINT>", sText);
                    return;
                }
                if (sVariable == "$CREDITPOINT")
                {
                    sText = (PlayObject.m_btCreditPoint).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$CREDITPOINT>", sText);
                    return;
                }
                if (sVariable == "$HW")
                {
                    sText = (PlayObject.m_WAbil.HandWeight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$HW>", sText);
                    return;
                }
                if (sVariable == "$MAXHW")
                {
                    sText = (PlayObject.m_WAbil.MaxHandWeight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXHW>", sText);
                    return;
                }
                if (sVariable == "$BW")
                {
                    sText = (PlayObject.m_WAbil.Weight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$BW>", sText);
                    return;
                }
                if (sVariable == "$MAXBW")
                {
                    sText = (PlayObject.m_WAbil.MaxWeight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXBW>", sText);
                    return;
                }
                if (sVariable == "$WW")
                {
                    sText = (PlayObject.m_WAbil.WearWeight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$WW>", sText);
                    return;
                }
                if (sVariable == "$MAXWW")
                {
                    sText = (PlayObject.m_WAbil.MaxWearWeight).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$MAXWW>", sText);
                    return;
                }
                if (sVariable == "$GOLDCOUNT")
                {
                    sText = (PlayObject.m_nGold).ToString() + "/" + (PlayObject.m_nGoldMax).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GOLDCOUNT>", sText);
                    return;
                }
                if (sVariable == "$GAMEGOLD")
                {
                    sText = (PlayObject.m_nGameGold).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GAMEGOLD>", sText);
                    return;
                }
                if (sVariable == "$GAMEDIAMOND")
                {
                    sText = (PlayObject.m_nGAMEDIAMOND).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GAMEDIAMOND>", sText);
                    return;
                }
                if (sVariable == "$GAMEGIRD")
                {
                    sText = (PlayObject.m_nGAMEGIRD).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GAMEGIRD>", sText);
                    return;
                }
                if (sVariable == "$GAMEPOINT")
                {
                    sText = (PlayObject.m_nGamePoint).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$GAMEPOINT>", sText);
                    return;
                }
                if (sVariable == "$HUNGER")
                {
                    sText = (PlayObject.GetMyStatus()).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$HUNGER>", sText);
                    return;
                }
                if (sVariable == "$LOGINTIME")
                {
                    sText = (PlayObject.m_dLogonTime).ToString();
                    sMsg = sub_49ADB8(sMsg, "<$LOGINTIME>", sText);
                    return;
                }
                if (sVariable == "$LOGINLONG")
                {
                    sText = ((HUtil32.GetTickCount() - PlayObject.m_dwLogonTick) / 60000).ToString() + "分钟";
                    sMsg = sub_49ADB8(sMsg, "<$LOGINLONG>", sText);
                    return;
                }
                if (sVariable == "$DRESS")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$DRESS>", sText);
                    return;
                }
                else if (sVariable == "$WEAPON")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$WEAPON>", sText);
                    return;
                }
                else if (sVariable == "$RIGHTHAND")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RIGHTHAND].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$RIGHTHAND>", sText);
                    return;
                }
                else if (sVariable == "$HELMET")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$HELMET>", sText);
                    return;
                }
                else if (sVariable == "$ZHULI")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$ZHULI>", sText);
                    return;
                }
                else if (sVariable == "$NECKLACE")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$NECKLACE>", sText);
                    return;
                }
                else if (sVariable == "$RING_R")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$RING_R>", sText);
                    return;
                }
                else if (sVariable == "$RING_L")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$RING_L>", sText);
                    return;
                }
                else if (sVariable == "$ARMRING_R")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$ARMRING_R>", sText);
                    return;
                }
                else if (sVariable == "$ARMRING_L")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$ARMRING_L>", sText);
                    return;
                }
                else if (sVariable == "$BUJUK")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$BUJUK>", sText);
                    return;
                }
                else if (sVariable == "$BELT")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BELT].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$BELT>", sText);
                    return;
                }
                else if (sVariable == "$BOOTS")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$BOOTS>", sText);
                    return;
                }
                else if (sVariable == "$CHARM")
                {
                    sText = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex);
                    sMsg = sub_49ADB8(sMsg, "<$CHARM>", sText);
                    return;
                }
                else if (sVariable == "$IPADDR")
                {
                    sText = PlayObject.m_sIPaddr;
                    sMsg = sub_49ADB8(sMsg, "<$IPADDR>", sText);
                    return;
                }
                else if (sVariable == "$IPLOCAL")
                {
                    sText = PlayObject.m_sIPLocal;
                    // GetIPLocal(PlayObject.m_sIPaddr);
                    sMsg = sub_49ADB8(sMsg, "<$IPLOCAL>", sText);
                    return;
                }
                else if (sVariable == "$GUILDBUILDPOINT")
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        sText = "无";
                    }
                    else
                    {
                        sText = (PlayObject.m_MyGuild.nBuildPoint).ToString();
                    }
                    sMsg = sub_49ADB8(sMsg, "<$GUILDBUILDPOINT>", sText);
                    return;
                }
                else if (sVariable == "$GUILDAURAEPOINT")
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        sText = "无";
                    }
                    else
                    {
                        sText = (PlayObject.m_MyGuild.nAurae).ToString();
                    }
                    sMsg = sub_49ADB8(sMsg, "<$GUILDAURAEPOINT>", sText);
                    return;
                }
                else if (sVariable == "$GUILDSTABILITYPOINT")
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        sText = "无";
                    }
                    else
                    {
                        sText = (PlayObject.m_MyGuild.nStability).ToString();
                    }
                    sMsg = sub_49ADB8(sMsg, "<$GUILDSTABILITYPOINT>", sText);
                    return;
                }
                if (sVariable == "$GUILDFLOURISHPOINT")
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        sText = "无";
                    }
                    else
                    {
                        sText = (PlayObject.m_MyGuild.nFlourishing).ToString();
                    }
                    sMsg = sub_49ADB8(sMsg, "<$GUILDFLOURISHPOINT>", sText);
                    return;
                }
                // 其它信息
                if (sVariable == "$REQUESTCASTLEWARITEM")
                {
                    sText = M2Share.g_Config.sZumaPiece;
                    sMsg = sub_49ADB8(sMsg, "<$REQUESTCASTLEWARITEM>", sText);
                    return;
                }
                if (sVariable == "$REQUESTCASTLEWARDAY")
                {
                    sText = M2Share.g_Config.sZumaPiece;
                    sMsg = sub_49ADB8(sMsg, "<$REQUESTCASTLEWARDAY>", sText);
                    return;
                }
                if (sVariable == "$REQUESTBUILDGUILDITEM")
                {
                    sText = M2Share.g_Config.sWomaHorn;
                    sMsg = sub_49ADB8(sMsg, "<$REQUESTBUILDGUILDITEM>", sText);
                    return;
                }
                if (sVariable == "$OWNERGUILD")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = NormNpc.m_Castle.m_sOwnGuild;
                        if (sText == "")
                        {
                            sText = "游戏管理";
                        }
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$OWNERGUILD>", sText);
                    return;
                }
                if (sVariable == "$CASTLENAME")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = NormNpc.m_Castle.m_sName;
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$CASTLENAME>", sText);
                    return;
                }
                if (sVariable == "$LORD")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        if (NormNpc.m_Castle.m_MasterGuild != null)
                        {
                            sText = NormNpc.m_Castle.m_MasterGuild.GetChiefName();
                        }
                        else
                        {
                            sText = "管理员";
                        }
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$LORD>", sText);
                    return;
                }
                if (sVariable == "$GUILDWARFEE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$GUILDWARFEE>", (M2Share.g_Config.nGuildWarPrice).ToString());
                    return;
                }
                if (sVariable == "$BUILDGUILDFEE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$BUILDGUILDFEE>", (M2Share.g_Config.nBuildGuildPrice).ToString());
                    return;
                }
                if (sVariable == "$CASTLEWARDATE")
                {
                    if (NormNpc.m_Castle == null)
                    {
                        NormNpc.m_Castle = M2Share.g_CastleManager.GetCastle(0);
                    }
                    if (NormNpc.m_Castle != null)
                    {
                        if (!NormNpc.m_Castle.m_boUnderWar)
                        {
                            sText = NormNpc.m_Castle.GetWarDate();
                            if (sText != "")
                            {
                                sMsg = sub_49ADB8(sMsg, "<$CASTLEWARDATE>", sText);
                            }
                            else
                            {
                                sMsg = "暂时没有行会攻城！！！\\ \\<返回/@main>";
                            }
                        }
                        else
                        {
                            sMsg = "现正在攻城中！！！\\ \\<返回/@main>";
                        }
                    }
                    else
                    {
                        sText = "????";
                    }
                    return;
                }
                if (sVariable == "$LISTOFWAR")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = NormNpc.m_Castle.GetAttackWarList();
                    }
                    else
                    {
                        sText = "????";
                    }
                    if (sText != "")
                    {
                        sMsg = sub_49ADB8(sMsg, "<$LISTOFWAR>", sText);
                    }
                    else
                    {
                        sMsg = "现在没有行会申请攻城战\\ \\<返回/@main>";
                    }
                    return;
                }
                if (sVariable == "$CASTLECHANGEDATE")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = NormNpc.m_Castle.m_ChangeDate.ToString();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$CASTLECHANGEDATE>", sText);
                    return;
                }
                if (sVariable == "$CASTLEWARLASTDATE")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = NormNpc.m_Castle.m_WarDate.ToString();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$CASTLEWARLASTDATE>", sText);
                    return;
                }
                if (sVariable == "$CASTLEGETDAYS")
                {
                    if (NormNpc.m_Castle != null)
                    {
                        sText = HUtil32.GetDayCount(DateTime.Now, NormNpc.m_Castle.m_ChangeDate).ToString();
                    }
                    else
                    {
                        sText = "????";
                    }
                    sMsg = sub_49ADB8(sMsg, "<$CASTLEGETDAYS>", sText);
                    return;
                }
                if (sVariable == "$CMD_DATE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_DATE>", M2Share.g_GameCommand.Data.sCmd);
                    return;
                }
                if (sVariable == "$CMD_ALLOWMSG")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_ALLOWMSG>", M2Share.g_GameCommand.ALLOWMSG.sCmd);
                    return;
                }
                if (sVariable == "$CMD_LETSHOUT")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_LETSHOUT>", M2Share.g_GameCommand.LETSHOUT.sCmd);
                    return;
                }
                if (sVariable == "$CMD_LETTRADE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_LETTRADE>", M2Share.g_GameCommand.LETTRADE.sCmd);
                    return;
                }
                if (sVariable == "$CMD_LETGUILD")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_LETGUILD>", M2Share.g_GameCommand.LETGUILD.sCmd);
                    return;
                }
                if (sVariable == "$CMD_ENDGUILD")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_ENDGUILD>", M2Share.g_GameCommand.ENDGUILD.sCmd);
                    return;
                }
                if (sVariable == "$CMD_BANGUILDCHAT")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_BANGUILDCHAT>", M2Share.g_GameCommand.BANGUILDCHAT.sCmd);
                    return;
                }
                if (sVariable == "$CMD_AUTHALLY")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_AUTHALLY>", M2Share.g_GameCommand.AUTHALLY.sCmd);
                    return;
                }
                if (sVariable == "$CMD_AUTH")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_AUTH>", M2Share.g_GameCommand.AUTH.sCmd);
                    return;
                }
                if (sVariable == "$CMD_AUTHCANCEL")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_AUTHCANCEL>", M2Share.g_GameCommand.AUTHCANCEL.sCmd);
                    return;
                }
                if (sVariable == "$CMD_USERMOVE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_USERMOVE>", M2Share.g_GameCommand.USERMOVE.sCmd);
                    return;
                }
                if (sVariable == "$CMD_SEARCHING")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_SEARCHING>", M2Share.g_GameCommand.SEARCHING.sCmd);
                    return;
                }
                if (sVariable == "$CMD_ALLOWGROUPCALL")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_ALLOWGROUPCALL>", M2Share.g_GameCommand.ALLOWGROUPCALL.sCmd);
                    return;
                }
                if (sVariable == "$CMD_GROUPRECALLL")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_GROUPRECALLL>", M2Share.g_GameCommand.GROUPRECALLL.sCmd);
                    return;
                }
                if (sVariable == "$CMD_ATTACKMODE")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_ATTACKMODE>", M2Share.g_GameCommand.ATTACKMODE.sCmd);
                    return;
                }
                if (sVariable == "$CMD_REST")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_REST>", M2Share.g_GameCommand.REST.sCmd);
                    return;
                }
                if (sVariable == "$CMD_STORAGESETPASSWORD")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_STORAGESETPASSWORD>", M2Share.g_GameCommand.SETPASSWORD.sCmd);
                    return;
                }
                if (sVariable == "$CMD_STORAGECHGPASSWORD")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_STORAGECHGPASSWORD>", M2Share.g_GameCommand.CHGPASSWORD.sCmd);
                    return;
                }
                if (sVariable == "$CMD_STORAGELOCK")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_STORAGELOCK>", M2Share.g_GameCommand.__Lock.sCmd);
                    return;
                }
                if (sVariable == "$CMD_STORAGEUNLOCK")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_STORAGEUNLOCK>", M2Share.g_GameCommand.UNLOCKSTORAGE.sCmd);
                    return;
                }
                if (sVariable == "$CMD_UNLOCK")
                {
                    sMsg = sub_49ADB8(sMsg, "<$CMD_UNLOCK>", M2Share.g_GameCommand.UnLock.sCmd);
                    return;
                }
                if (HUtil32.CompareLStr(sVariable, "$HUMAN(", 7))
                {
                    HUtil32.ArrestStringEx(sVariable, "(", ")", ref s14);
                    boFoundVar = false;
                    if (PlayObject.m_DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_DynamicVarList.Count; i++)
                        {
                            DynamicVar = PlayObject.m_DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((s14).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (DynamicVar.nInternet).ToString());
                                        boFoundVar = true;
                                        break;
                                    case TVarType.vString:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", DynamicVar.sString);
                                        boFoundVar = true;
                                        break;
                                }
                                break;
                            }
                        }
                    }
                    if (!boFoundVar)
                    {
                        sMsg = "??";
                    }
                    return;
                }
                if (HUtil32.CompareLStr(sVariable, "$GUILD(", 7))
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        return;
                    }
                    HUtil32.ArrestStringEx(sVariable, "(", ")", ref s14);
                    boFoundVar = false;
                    if (PlayObject.m_MyGuild.m_DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < PlayObject.m_MyGuild.m_DynamicVarList.Count; i++)
                        {
                            DynamicVar = PlayObject.m_MyGuild.m_DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((s14).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (DynamicVar.nInternet).ToString());
                                        boFoundVar = true;
                                        break;
                                    case TVarType.vString:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", DynamicVar.sString);
                                        boFoundVar = true;
                                        break;
                                }
                                break;
                            }
                        }
                    }
                    if (!boFoundVar)
                    {
                        sMsg = "??";
                    }
                    return;
                }
                if (HUtil32.CompareLStr(sVariable, "$GLOBAL(", 8))
                {
                    HUtil32.ArrestStringEx(sVariable, "(", ")", ref s14);
                    boFoundVar = false;
                    if (M2Share.g_DynamicVarList.Count > 0)
                    {
                        for (int i = 0; i < M2Share.g_DynamicVarList.Count; i++)
                        {
                            DynamicVar = M2Share.g_DynamicVarList[i];
                            if ((DynamicVar.sName).ToLower().CompareTo((s14).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (DynamicVar.nInternet).ToString());
                                        boFoundVar = true;
                                        break;
                                    case TVarType.vString:
                                        sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", DynamicVar.sString);
                                        boFoundVar = true;
                                        break;
                                }
                                break;
                            }
                        }
                    }
                    if (!boFoundVar)
                    {
                        sMsg = "??";
                    }
                    return;
                }
                if (HUtil32.CompareLStr(sVariable, "$STR(", 5))
                {
                    HUtil32.ArrestStringEx(sVariable, "(", ")", ref s14);
                    n18 = M2Share.GetValNameNo(s14);
                    if (n18 >= 0)
                    {
                        if (HUtil32.rangeInDefined(n18, 0, 99))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (PlayObject.m_nVal[n18]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 100, 199))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (M2Share.g_Config.GlobalVal[n18 - 100]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 200, 299))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (PlayObject.m_DyVal[n18 - 200]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 300, 399))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (PlayObject.m_nMval[n18 - 300]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 400, 499))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (M2Share.g_Config.GlobaDyMval[n18 - 400]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 500, 599))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (PlayObject.m_nInteger[n18 - 500]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 600, 699))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", PlayObject.m_sString[n18 - 600]);
                        }
                        else if (HUtil32.rangeInDefined(n18, 700, 799))
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", M2Share.g_Config.GlobalAVal[n18 - 700]);
                        }
                        else if (HUtil32.rangeInDefined(n18, 800, 1199)) // G变量(100-499)
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", (M2Share.g_Config.GlobalVal[n18 - 700]).ToString());
                        }
                        else if (HUtil32.rangeInDefined(n18, 1200, 1599)) // A变量(100-499)
                        {
                            sMsg = sub_49ADB8(sMsg, "<" + sVariable + ">", M2Share.g_Config.GlobalAVal[n18 - 1100]);
                        }
                    }
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetVariableText");
            }
        }

        public static string sub_49ADB8(string sMsg, string sStr, string sText)
        {
            string result;
            int n10;
            string s14;
            string s18;
            n10 = sMsg.IndexOf(sStr);
            if (n10 > -1)
            {
                s14 = sMsg.Substring(1 - 1, n10);
                s18 = sMsg.Substring(sStr.Length + n10, sMsg.Length - (sStr.Length + n10));
                result = s14 + sText + s18;
            }
            else
            {
                result = sMsg;
            }
            return result;
        }

        /// <summary>
        /// 取玩家变量
        /// </summary>
        /// <param name="PlayObject">当前玩家对象</param>
        /// <param name="sVariable">变量名称</param>
        /// <param name="sValue">字符串</param>
        /// <param name="nValue">整形</param>
        /// <param name="nDataType">变量类型 0 全局变量信息 1 个人变量信息</param>
        /// <returns>是否成功</returns>
        public static bool GetHumanInfoValue(TPlayObject PlayObject, string sVariable, ref string sValue, ref int nValue, ref int nDataType)
        {
            bool result = false;
            string sMsg;
            string s10 = string.Empty;
            string sVarValue2 = string.Empty;
            int nSecond;
            TDynamicVar DynamicVar;
            int wHour;
            int wMinute;
            int wSecond;
            sValue = "";
            nValue = -1;
            nDataType = -1;
            result = false;
            if (sVariable == "")
            {
                return result;
            }
            sMsg = sVariable;
            HUtil32.ArrestStringEx(sMsg, "<", ">", ref s10);
            if (s10 == "")
            {
                return result;
            }
            sVariable = s10;
            if (sVariable == "$SERVERNAME")// 全局信息
            {
                sValue = M2Share.g_Config.sServerName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$SERVERIP")
            {
                sValue = M2Share.g_Config.sServerIPaddr;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$WEBSITE")
            {
                sValue = M2Share.g_Config.sWebSite;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BBSSITE")
            {
                sValue = M2Share.g_Config.sBbsSite;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$CLIENTDOWNLOAD")
            {
                sValue = M2Share.g_Config.sClientDownload;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$QQ")
            {
                sValue = M2Share.g_Config.sQQ;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$PHONE")
            {
                sValue = M2Share.g_Config.sPhone;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT0")
            {
                sValue = M2Share.g_Config.sBankAccount0;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT1")
            {
                sValue = M2Share.g_Config.sBankAccount1;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT2")
            {
                sValue = M2Share.g_Config.sBankAccount2;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT3")
            {
                sValue = M2Share.g_Config.sBankAccount3;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT4")
            {
                sValue = M2Share.g_Config.sBankAccount4;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT5")
            {
                sValue = M2Share.g_Config.sBankAccount5;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT6")
            {
                sValue = M2Share.g_Config.sBankAccount6;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT7")
            {
                sValue = M2Share.g_Config.sBankAccount7;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT8")
            {
                sValue = M2Share.g_Config.sBankAccount8;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$BANKACCOUNT9")
            {
                sValue = M2Share.g_Config.sBankAccount9;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEGOLDNAME")
            {
                sValue = M2Share.g_Config.sGameGoldName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEDIAMONDNAME")
            {
                sValue = M2Share.g_Config.sGameDiaMond;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEGIRDNAME")
            {
                sValue = M2Share.g_Config.sGameGird;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEPOINTNAME")
            {
                sValue = M2Share.g_Config.sGamePointName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$USERCOUNT")
            {
                sValue = (M2Share.UserEngine.PlayObjectCount).ToString();
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$MACRUNTIME")
            {
                sValue = (HUtil32.GetTickCount() / 86400000).ToString(); // (24 * 60 * 60 * 1000)
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$SERVERRUNTIME")
            {
                nSecond = Convert.ToInt32((HUtil32.GetTickCount() - M2Share.g_dwStartTick) / 1000);
                wHour = nSecond / 3600;
                wMinute = (nSecond / 60) % 60;
                wSecond = nSecond % 60;
                sValue = string.Format("%d:%d:%d", wHour, wMinute, wSecond);
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$DATETIME")
            {
                // sValue = FormatDateTime("dddddd,dddd,hh:mm:nn", DateTime.Now);
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$USERNAME") // 个人信息
            {
                sValue = PlayObject.m_sCharName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$KILLER") // 杀人者变量
            {
                if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                {
                    if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_PLAYOBJECT))
                    {
                        sValue = PlayObject.m_LastHiter.m_sCharName;
                    }
                    else if ((PlayObject.m_LastHiter.m_btRaceServer == Grobal2.RC_HEROOBJECT))
                    {
                        if (PlayObject.m_LastHiter.m_Master != null)
                        {
                            sValue = PlayObject.m_LastHiter.m_Master.m_sCharName;
                        }
                        else
                        {
                            sValue = "未知";
                        }
                    }
                }
                else
                {
                    sValue = "未知";
                }
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$MONKILLER") // 杀人的怪物变量
            {
                if (PlayObject.m_boDeath && (PlayObject.m_LastHiter != null))
                {
                    if ((PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_PLAYOBJECT) && (PlayObject.m_LastHiter.m_btRaceServer != Grobal2.RC_HEROOBJECT))
                    {
                        sValue = PlayObject.m_LastHiter.m_sCharName;
                    }
                }
                else
                {
                    sValue = "未知";
                }
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$USERALLNAME") // 全名 
            {
                sValue = PlayObject.GetShowName();
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$SFNAME") // 师傅名 
            {
                sValue = PlayObject.m_sMasterName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$STATSERVERTIME")
            {
                // 显示M2启动时间
                //sValue = svMain.Units.svMain.FrmMain.LbRunTime.Text;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$RUNDATETIME") // 开区间隔时间
            {
                //sValue = svMain.FrmMain.LbTimeCount.Text;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$RANDOMNO") // 随机值变量
            {
                nValue = HUtil32.Random(Int32.MaxValue);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$USERID") // 登录账号
            {
                sValue = PlayObject.m_sUserID;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$IPADDR")// 登录IP
            {
                sValue = PlayObject.m_sIPaddr;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$X")  // 人物X坐标
            {
                nValue = PlayObject.m_nCurrX;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$Y") // 人物Y坐标
            {
                nValue = PlayObject.m_nCurrY;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAP")
            {
                sValue = PlayObject.m_PEnvir.sMapName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GUILDNAME")
            {
                if (PlayObject.m_MyGuild != null)
                {
                    sValue = PlayObject.m_MyGuild.sGuildName;
                }
                else
                {
                    sValue = "无";
                }
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GUILDMEMBERCOUNT") // 行会成员上限
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.GuildMemberCount;
                    nDataType = 1;
                    result = true;
                    return result;
                }
            }
            if (sVariable == "$GUILDFOUNTAIN") // 行会泉水仓库
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.m_nGuildFountain;
                    nDataType = 1;
                    result = true;
                    return result;
                }
            }
            if (sVariable == "$ALCOHOL") // 酒量
            {
                nValue = PlayObject.m_Abil.MaxAlcohol;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MEDICINEVALUE") // 药力值
            {
                nValue = PlayObject.m_Abil.MedicineValue;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$RANKNAME")
            {
                sValue = PlayObject.m_sGuildRankName;
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$LEVEL")
            {
                nValue = PlayObject.m_Abil.Level;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$USEGAMEGIRD") // 每次使用灵符数，$USEGAMEGIRD变量使用 
            {
                nValue = (int)PlayObject.m_UseGameGird;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$BUYSHOP")// 每次商铺花的元宝数量
            {
                nValue = PlayObject.m_BuyShopPrice;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GETCRYSTALEXP")// 天地结晶可提取的经验
            {
                nValue = PlayObject.m_nGetCrystalExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GETCRYSTALNGEXP") // 天地结晶可提取的内功经验
            {
                nValue = (int)PlayObject.m_nGetCrystalNGExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$CRYSTALEXP") // 天地结晶当前的经验
            {
                nValue = (int)PlayObject.m_CrystalExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$CRYSTALNGEXP")  // 天地结晶当前的内功经验
            {
                nValue = (int)PlayObject.m_CrystalNGExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$CRYSTALLEVEL")  // 天地结晶等级
            {
                nValue = HUtil32._MIN(5, PlayObject.m_CrystalLevel);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GETEXP")  // 人物取得的经验
            {
                nValue = PlayObject.m_GetExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$HEROGETEXP") // 英雄取得的经验
            {
                if (PlayObject.m_MyHero != null)
                {
                    nValue = ((THeroObject)(PlayObject.m_MyHero)).m_GetExp;
                }
                else
                {
                    nValue = 0;
                }
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GLORYPOINT") // 人物荣誉值
            {
                nValue = PlayObject.m_btGameGlory;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$HP")
            {
                nValue = PlayObject.m_WAbil.HP;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXHP")
            {
                nValue = PlayObject.m_WAbil.MaxHP;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MP")
            {
                nValue = PlayObject.m_WAbil.MP;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXMP")
            {
                nValue = PlayObject.m_WAbil.MaxMP;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$AC")
            {
                nValue = HUtil32.LoWord(PlayObject.m_WAbil.AC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXAC")
            {
                nValue = HUtil32.HiWord(PlayObject.m_WAbil.AC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAC")
            {
                nValue = HUtil32.LoWord(PlayObject.m_WAbil.MAC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXMAC")
            {
                nValue = HUtil32.HiWord(PlayObject.m_WAbil.MAC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$DC")
            {
                nValue = HUtil32.LoWord(PlayObject.m_WAbil.DC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXDC")
            {
                nValue = HUtil32.HiWord(PlayObject.m_WAbil.DC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MC")
            {
                nValue = HUtil32.LoWord(PlayObject.m_WAbil.MC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXMC")
            {
                nValue = HUtil32.HiWord(PlayObject.m_WAbil.MC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$SC")
            {
                nValue = HUtil32.LoWord(PlayObject.m_WAbil.SC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXSC")
            {
                nValue = HUtil32.HiWord(PlayObject.m_WAbil.SC);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$EXP")
            {
                nValue = (int)PlayObject.m_Abil.Exp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXEXP")
            {
                nValue = (int)PlayObject.m_Abil.MaxExp;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$PKPOINT")
            {
                nValue = PlayObject.m_nPkPoint;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$CREDITPOINT")
            {
                nValue = PlayObject.m_btCreditPoint;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$HW")
            {
                nValue = PlayObject.m_WAbil.HandWeight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXHW")
            {
                nValue = PlayObject.m_WAbil.MaxHandWeight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$BW")
            {
                nValue = PlayObject.m_WAbil.Weight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXBW")
            {
                nValue = PlayObject.m_WAbil.MaxWeight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$WW")
            {
                nValue = PlayObject.m_WAbil.WearWeight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$MAXWW")
            {
                nValue = PlayObject.m_WAbil.MaxWearWeight;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GOLDCOUNT")
            {
                nValue = PlayObject.m_nGold;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEGOLD")
            {
                nValue = PlayObject.m_nGameGold;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEDIAMOND")
            {
                nValue = PlayObject.m_nGAMEDIAMOND;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$GAMEGIRD")
            {
                nValue = PlayObject.m_nGAMEGIRD;
                nDataType = 1;
                result = true;
                return result;
            }
            if (HUtil32.CompareLStr(sVariable, "$HUMAN", 6))  // 人物变量
            {
                HUtil32.ArrestStringEx(sVariable, "(", ")", ref sVarValue2);
                if (PlayObject.m_DynamicVarList.Count > 0)
                {
                    for (int i = 0; i < PlayObject.m_DynamicVarList.Count; i++)
                    {
                        DynamicVar = PlayObject.m_DynamicVarList[i];
                        if ((DynamicVar.sName).ToLower().CompareTo((sVarValue2).ToLower()) == 0)
                        {
                            switch (DynamicVar.VarType)
                            {
                                case TVarType.vInteger:
                                    nValue = DynamicVar.nInternet;
                                    nDataType = 1;
                                    result = true;
                                    return result;
                                case TVarType.vString://加对自定义字符型变量的支持
                                    sValue = DynamicVar.sString;
                                    nDataType = 0;
                                    result = true;
                                    return result;
                            }
                            break;
                        }
                    }
                }
            }
            if (sVariable == "$GAMEPOINT")
            {
                nValue = PlayObject.m_nGamePoint;
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$HUNGER")
            {
                nValue = PlayObject.GetMyStatus();
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$LOGINTIME")
            {
                sValue = (PlayObject.m_dLogonTime).ToString();
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$DATETIME")
            {
                //sValue = FormatDateTime("dddddd,dddd,hh:mm:nn", DateTime.Now);
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$LOGINLONG")
            {
                nValue = Convert.ToInt32((HUtil32.GetTickCount() - PlayObject.m_dwLogonTick) / 60000);
                nDataType = 1;
                result = true;
                return result;
            }
            if (sVariable == "$DRESS")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_DRESS].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$WEAPON")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_WEAPON].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$RIGHTHAND")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RIGHTHAND].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$HELMET")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_HELMET].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$ZHULI")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ZHULI].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$NECKLACE")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_NECKLACE].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$RING_R")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGR].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$RING_L")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_RINGL].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$ARMRING_R")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGR].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$ARMRING_L")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_ARMRINGL].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$BUJUK")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BUJUK].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$BELT")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BELT].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$BOOTS")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_BOOTS].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$CHARM")
            {
                sValue = M2Share.UserEngine.GetStdItemName(PlayObject.m_UseItems[Grobal2.U_CHARM].wIndex);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$IPADDR")
            {
                sValue = PlayObject.m_sIPaddr;
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$IPLOCAL")
            {
                sValue = PlayObject.m_sIPLocal;
                // GetIPLocal(PlayObject.m_sIPaddr);
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$GUILDBUILDPOINT")
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.nBuildPoint;
                }
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$GUILDAURAEPOINT")
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.nAurae;
                }
                nDataType = 0;
                result = true;
                return result;
            }
            else if (sVariable == "$GUILDSTABILITYPOINT")
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.nStability;
                }
                nDataType = 0;
                result = true;
                return result;
            }
            if (sVariable == "$GUILDFLOURISHPOINT")
            {
                if (PlayObject.m_MyGuild != null)
                {
                    nValue = PlayObject.m_MyGuild.nFlourishing;
                }
                nDataType = 0;
                result = true;
                return result;
            }
            return result;
        }

        /// <summary>
        /// 设置文本变量值
        /// </summary>
        /// <param name="PlayObject">当前玩家</param>
        /// <param name="sVarName">名称名称</param>
        /// <param name="sValue">字符串</param>
        /// <param name="nValue">整形</param>
        /// <param name="nDataType">变量类型 0:全局变量信息 1:个人变量信息</param>
        /// <returns>是否成功</returns>
        public static bool SetValNameValue(TPlayObject PlayObject, string sVarName, string sValue, int nValue, int nDataType)
        {
            bool result = false;
            int n100 = M2Share.GetValNameNo(sVarName);
            if (n100 >= 0)
            {
                switch (nDataType)
                {
                    case 1:
                        if (HUtil32.rangeInDefined(n100, 0, 99))
                        {
                            PlayObject.m_nVal[n100] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 100, 199))
                        {
                            M2Share.g_Config.GlobalVal[n100 - 100] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 200, 299))
                        {
                            PlayObject.m_DyVal[n100 - 200] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 300, 399))
                        {
                            PlayObject.m_nMval[n100 - 300] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 400, 499))
                        {
                            M2Share.g_Config.GlobaDyMval[n100 - 400] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 500, 599))
                        {
                            PlayObject.m_nInteger[n100 - 500] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 600, 699))
                        {
                            PlayObject.m_sString[n100 - 600] = (nValue).ToString();
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 700, 799))
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 700] = (nValue).ToString();
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 800, 1199))    // G变量
                        {
                            M2Share.g_Config.GlobalVal[n100 - 700] = nValue;
                            result = true;
                        }
                        else if (HUtil32.rangeInDefined(n100, 1200, 1599))    // A变量
                        {
                            M2Share.g_Config.GlobalAVal[n100 - 1100] = (nValue).ToString();
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                        break;
                    case 0:



                        switch (n100)
                        {

                            // Modify the A .. B: 0 .. 99
                            case 0:
                                // 20090102 增加
                                PlayObject.m_nVal[n100] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 100 .. 199
                            case 100:
                                M2Share.g_Config.GlobalVal[n100 - 100] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 200 .. 299
                            case 200:
                                PlayObject.m_DyVal[n100 - 200] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 300 .. 399
                            case 300:
                                PlayObject.m_nMval[n100 - 300] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 400 .. 499
                            case 400:
                                M2Share.g_Config.GlobaDyMval[n100 - 400] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 500 .. 599
                            case 500:
                                PlayObject.m_nInteger[n100 - 500] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 600 .. 699
                            case 600:
                                PlayObject.m_sString[n100 - 600] = sValue;
                                result = true;
                                break;
                            // Modify the A .. B: 700 .. 799
                            case 700:
                                M2Share.g_Config.GlobalAVal[n100 - 700] = sValue;
                                result = true;
                                break;
                            // Modify the A .. B: 800 .. 1199
                            case 800:
                                M2Share.g_Config.GlobalVal[n100 - 700] = HUtil32.Str_ToInt(sValue, 0);
                                result = true;
                                break;
                            // Modify the A .. B: 1200 .. 1599
                            case 1200:
                                // 20080903 A变量(100-499)
                                M2Share.g_Config.GlobalAVal[n100 - 1100] = sValue;
                                result = true;
                                break;
                            default:
                                result = false;
                                break;
                        }
                        break;
                    case 3:
                        switch (n100)
                        {
                            // Modify the A .. B: 0 .. 99
                            case 0:
                                // 20080323 原为0..99
                                PlayObject.m_nVal[n100] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 100 .. 199
                            case 100:
                                M2Share.g_Config.GlobalVal[n100 - 100] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 200 .. 299
                            case 200:
                                // 20080323 原为200..209
                                PlayObject.m_DyVal[n100 - 200] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 300 .. 399
                            case 300:
                                PlayObject.m_nMval[n100 - 300] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 400 .. 499
                            case 400:
                                M2Share.g_Config.GlobaDyMval[n100 - 400] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 500 .. 599
                            case 500:
                                PlayObject.m_nInteger[n100 - 500] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 600 .. 699
                            case 600:
                                PlayObject.m_sString[n100 - 600] = sValue;
                                result = true;
                                break;
                            // Modify the A .. B: 700 .. 799
                            case 700:
                                M2Share.g_Config.GlobalAVal[n100 - 700] = sValue;
                                result = true;
                                break;
                            // Modify the A .. B: 800 .. 1199
                            case 800:
                                // 20080903 G变量
                                M2Share.g_Config.GlobalVal[n100 - 700] = nValue;
                                result = true;
                                break;
                            // Modify the A .. B: 1200 .. 1599
                            case 1200:
                                // 20080903 A变量(100-499)
                                M2Share.g_Config.GlobalAVal[n100 - 1100] = sValue;
                                result = true;
                                break;
                            default:
                                result = false;
                                break;
                        }
                        break;
                }
            }
            else
            {
                result = false;
            }
            return result;
        }

        /// <summary>
        /// 设置变量对应的值
        /// </summary>
        /// <returns></returns>
        public static bool SetVarValues(TPlayObject PlayObject, int nValues, int nInteger, string sString)
        {
            bool result = false;
            if (HUtil32.rangeInDefined(nValues, 0, 99))
            {
                PlayObject.m_nVal[nValues] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 100, 199))
            {
                M2Share.g_Config.GlobalVal[nValues - 100] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 200, 299))
            {
                PlayObject.m_DyVal[nValues - 200] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 300, 399))
            {
                PlayObject.m_nMval[nValues - 300] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 400, 499))
            {
                M2Share.g_Config.GlobaDyMval[nValues - 400] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 500, 599))
            {
                PlayObject.m_nInteger[nValues - 500] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 600, 699))
            {
                PlayObject.m_sString[nValues - 600] = sString;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 700, 799))
            {
                M2Share.g_Config.GlobalAVal[nValues - 700] = sString;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 800, 1199)) //G变量
            {
                M2Share.g_Config.GlobalVal[nValues - 700] = nInteger;
                result = true;
            }
            else if (HUtil32.rangeInDefined(nValues, 1200, 1599))//A变量
            {
                M2Share.g_Config.GlobalAVal[nValues - 1100] = sString;
                result = true;
            }
            return result;
        }

        /// <summary>
        /// 根据变量名称取对应值
        /// </summary>
        public static bool GetVarValues(TPlayObject PlayObject, int nVarName, ref int nInteger, ref string sString)
        {
            bool result = false;
            if (HUtil32.rangeInDefined(nVarName, 0, 99))
            {
                nInteger = PlayObject.m_nVal[nVarName];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 100, 199))
            {
                nInteger = M2Share.g_Config.GlobalVal[nVarName - 100];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 200, 299))
            {
                nInteger = PlayObject.m_DyVal[nVarName - 200];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 300, 399))
            {
                nInteger = PlayObject.m_nMval[nVarName - 300];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 400, 499))
            {
                nInteger = M2Share.g_Config.GlobaDyMval[nVarName - 400];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 500, 599))
            {
                nInteger = PlayObject.m_nInteger[nVarName - 500];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 600, 699))
            {
                sString = PlayObject.m_sString[nVarName - 600];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 700, 799))
            {
                sString = M2Share.g_Config.GlobalAVal[nVarName - 700];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 800, 1199))//G变量
            {
                nInteger = M2Share.g_Config.GlobalVal[nVarName - 700];
                result = true;
            }
            else if (HUtil32.rangeInDefined(nVarName, 1200, 1599))//A变量(100-499)
            {
                sString = M2Share.g_Config.GlobalAVal[nVarName - 1100];
                result = true;
            }
            return result;
        }

        internal bool CheckVarNameNo(TNormNpc NormNpc, TPlayObject PlayObject, TQuestConditionInfo CheckQuestConditionInfo, ref int n140, ref int n180)
        {
            bool result = false;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            n140 = -1;
            n180 = -1;
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = CheckQuestConditionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = CheckQuestConditionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = CheckQuestConditionInfo.sParam3;
            }
            switch (GotoLable_CheckVarNameNo_GetDataType(CheckQuestConditionInfo))
            {
                case 0:
                    if (GotoLable_CheckVarNameNo_GetDynamicVarValue(PlayObject, sParam1, sParam2, ref n140) && GotoLable_CheckVarNameNo_GetValValue(PlayObject, sParam3, ref n180))
                    {
                        result = true;
                    }
                    break;
                case 1:
                    n180 = CheckQuestConditionInfo.nParam3;
                    if (GotoLable_CheckVarNameNo_GetDynamicVarValue(PlayObject, sParam1, sParam2, ref n140))
                    {
                        result = true;
                    }
                    break;
                case 2:
                    if (GotoLable_CheckVarNameNo_GetValValue(PlayObject, sParam1, ref n140) && GotoLable_CheckVarNameNo_GetValValue(PlayObject, sParam2, ref n180))
                    {
                        result = true;
                    }
                    break;
                case 3:
                    if (GotoLable_CheckVarNameNo_GetValValue(PlayObject, sParam1, ref n140) && GotoLable_CheckVarNameNo_GetDynamicVarValue(PlayObject, sParam2, sParam3, ref n180))
                    {
                        result = true;
                    }
                    break;
                case 4:
                    n180 = CheckQuestConditionInfo.nParam2;
                    if (GotoLable_CheckVarNameNo_GetValValue(PlayObject, sParam1, ref n140))
                    {
                        result = true;
                    }
                    break;
                case 5:
                    break;
            }
            return result;
        }

        internal bool GotoLable_CheckVarNameNo_GetValValue(TPlayObject PlayObject, string sValName, ref int nValue)
        {
            bool result = false;
            nValue = 0;
            int n100 = M2Share.GetValNameNo(sValName);
            if (n100 >= 0)
            {
                if (HUtil32.rangeInDefined(n100, 0, 99))
                {
                    nValue = PlayObject.m_nVal[n100];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 100, 199))
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 100];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 200, 299))
                {
                    nValue = PlayObject.m_DyVal[n100 - 200];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 300, 399))
                {
                    nValue = PlayObject.m_nMval[n100 - 300];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 400, 499))
                {
                    nValue = M2Share.g_Config.GlobaDyMval[n100 - 400];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 500, 599))
                {
                    nValue = PlayObject.m_nInteger[n100 - 500];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 600, 699))
                {
                    if (HUtil32.IsStringNumber(PlayObject.m_sString[n100 - 600]))
                    {
                        nValue = HUtil32.Str_ToInt(PlayObject.m_sString[n100 - 600], 0);
                        result = true;
                    }
                }
                else if (HUtil32.rangeInDefined(n100, 700, 799))
                {
                    if (HUtil32.IsStringNumber(M2Share.g_Config.GlobalAVal[n100 - 700]))
                    {
                        nValue = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n100 - 700], 0);
                        result = true;
                    }
                }
                else if (HUtil32.rangeInDefined(n100, 800, 1199))//G变量
                {
                    nValue = M2Share.g_Config.GlobalVal[n100 - 700];
                    result = true;
                }
                else if (HUtil32.rangeInDefined(n100, 1200, 1599))//A变量
                {
                    if (HUtil32.IsStringNumber(M2Share.g_Config.GlobalAVal[n100 - 1100]))
                    {
                        nValue = HUtil32.Str_ToInt(M2Share.g_Config.GlobalAVal[n100 - 1100], 0);
                        result = true;
                    }
                }
            }
            return result;
        }

        internal bool GotoLable_CheckVarNameNo_GetDynamicVarValue(TPlayObject PlayObject, string sVarType, string sValName, ref int nValue)
        {
            bool result = false;
            TDynamicVar DynamicVar;
            IList<TDynamicVar> DynamicVarList;
            string sName = string.Empty;
            result = false;
            DynamicVarList = GetDynamicVarList(PlayObject, sVarType, ref sName);
            if (DynamicVarList == null)
            {
                return result;
            }
            else
            {
                if (DynamicVarList.Count > 0)
                {
                    for (int i = 0; i < DynamicVarList.Count; i++)
                    {
                        DynamicVar = DynamicVarList[i];
                        if (DynamicVar != null)
                        {
                            if ((DynamicVar.sName).ToLower().CompareTo((sValName).ToLower()) == 0)
                            {
                                switch (DynamicVar.VarType)
                                {
                                    case TVarType.vInteger:
                                        nValue = DynamicVar.nInternet;
                                        result = true;
                                        break;
                                    case TVarType.vString:
                                        break;
                                }
                                break;
                            }
                        }
                    }
                }
            }
            return result;
        }

        /// <summary>
        /// 取变量类型
        /// </summary>
        /// <param name="CheckQuestConditionInfo"></param>
        /// <returns></returns>
        internal int GotoLable_CheckVarNameNo_GetDataType(TQuestConditionInfo CheckQuestConditionInfo)
        {
            int result = -1;
            string sParam1 = string.Empty;
            string sParam2 = string.Empty;
            string sParam3 = string.Empty;
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam1, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam1, "(", ")", ref sParam1);
            }
            else
            {
                sParam1 = CheckQuestConditionInfo.sParam1;
            }
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam2, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam2, "(", ")", ref sParam2);
            }
            else
            {
                sParam2 = CheckQuestConditionInfo.sParam2;
            }
            if (HUtil32.CompareLStr(CheckQuestConditionInfo.sParam3, "<$STR(", 6))
            {
                HUtil32.ArrestStringEx(CheckQuestConditionInfo.sParam3, "(", ")", ref sParam3);
            }
            else
            {
                sParam3 = CheckQuestConditionInfo.sParam3;
            }
            if (HUtil32.IsVarNumber(sParam1))
            {
                if ((sParam3 != "") && (M2Share.GetValNameNo(sParam3) >= 0))
                {
                    result = 0;
                }
                else if ((sParam3 != "") && HUtil32.IsStringNumber(sParam3))
                {
                    result = 1;
                }
                return result;
            }
            if (M2Share.GetValNameNo(sParam1) >= 0)
            {
                if ((sParam2 != "") && (M2Share.GetValNameNo(sParam2) >= 0))
                {
                    result = 2;
                }
                else if ((sParam2 != "") && HUtil32.IsVarNumber(sParam2) && (sParam3 != ""))
                {
                    result = 3;
                }
                else if ((sParam2 != "") && HUtil32.IsStringNumber(sParam2))
                {
                    result = 4;
                }
            }
            return result;
        }

        public IList<TDynamicVar> GetDynamicVarList(TPlayObject PlayObject, string sType, ref string sName)
        {
            IList<TDynamicVar> result = null;
            try
            {
                result = null;
                if (HUtil32.CompareLStr(sType, "HUMAN", 5))
                {
                    result = PlayObject.m_DynamicVarList;
                    sName = PlayObject.m_sCharName;
                }
                else if (HUtil32.CompareLStr(sType, "GUILD", 5))
                {
                    if (PlayObject.m_MyGuild == null)
                    {
                        return result;
                    }
                    result = PlayObject.m_MyGuild.m_DynamicVarList;
                    sName = PlayObject.m_MyGuild.sGuildName;
                }
                else if (HUtil32.CompareLStr(sType, "GLOBAL", 6))
                {
                    result = M2Share.g_DynamicVarList;
                    sName = "GLOBAL";
                }
            }
            catch
            {
                M2Share.MainOutMessage("[异常] TNormNpc.GetDynamicVarList");
            }
            return result;
        }
    }
}